function get1() {
    fetch('/file1', {
        method: 'get',
        responseType: 'blob',
        headers: {
            'Access-Control-Allow-Origin': "*"
        }
    })
        .then(res => res.blob())
        .then(res => {
            const src = URL.createObjectURL(res);
            document.querySelector('img').src = src;
            console.log(src)
        })
}


function publishControlMsg(value){
    url = 'http://127.0.0.1:8005/publish/control/'+value;
    console.log(url);
    fetch(url, {method: 'put'})
        .then(res => res.json())
        .then(res => {
            console.log(res)
        })
}

function getRedisKey(key, callback){
    url = 'http://127.0.0.1:8005/get/'+key;
    console.log(url);
    fetch(url)
        .then(res => res.json())
        .then(res => res.get)
        .then(res => callback(res))
}



function sendVideoPath(){
    value = document.getElementById('video_path').value;
    value = 'path='+value;
    value = escape(value);
    publishControlMsg(value);

}


function range_change() {
    var value = document.getElementById('video_progress_control').value;
    value = 'bar='+value;
    publishControlMsg(value);
}

window.onload= function(){
    getRedisKey('video_path', function(value){
        console.log(value);
        document.getElementById("video_path").value = value;
    });
}